import {
    pxToRem
  } from "./pxToRem";
  import * as echarts from 'echarts';

  export function salesStatistics(seriesData) {

    var option = {
      grid: {
        //生成的echarts图片和顶部的距离
        top: '30%',
        bottom: '5%', //echarts图片和底部的距离
        left: '5%', //echarts图片和左边的距离
        right: '5%', //echarts图片和右边的间距,
        containLabel: true //当containLabel:为ture时，以上设置生效
      },
  
      legend: {
        top: '5%',
        icon: 'rect',
        textStyle: {
          color: '#fff',
          fontSize: pxToRem(14),
          rich: {
            a: {
              verticalAlign: 'top',
            },
          },
          padding: [pxToRem(4), 0, 0, 0],
        },
  
        itemGap: pxToRem(15), // 设置间距
        itemHeight: pxToRem(18), // 设置icon高度
        itemWidth: pxToRem(30),
        color: ['red', 'blue']
  
      },
  
      tooltip: {
        backgroundColor: 'rgba(67, 128, 240, 0.3)',
        borderColor: 'rgba(67, 128, 240, 0.3)', // 设置边框颜色为红色
        borderWidth: 2, // 设置边框宽度
        trigger: 'axis',
        textStyle: {
          color: '#fff',
        },
        axisPointer: {
          type: 'shadow'
        },
      },
  
      xAxis: [{
        type: 'category',
        boundaryGap: false,
        data: seriesData.xAxis,
        // axisLabel: {
        //     interval: interval // 动态设置间隔
        // },
        axisLabel: {
          textStyle: {
            fontSize: pxToRem(14)
          },
  
        },
      }],
      yAxis: [{
          type: 'value',
          splitLine: false,
          axisLabel: {
            textStyle: {
              fontSize: pxToRem(14)
            },
          },
        }
  
      ],
      series: [{
  
          name: '辽宁省',
          type: 'line',
          smooth: true,
          symbol: 'none', // 设置为 'none' 去掉折线图的点
          itemStyle: {
            normal: {
              color: 'rgba(7,68,153, 1)',
              lineStyle: {
                color: 'rgba(7,68,153, 1)',
                width: 1.5,
              },
              areaStyle: {
                color: {
                  type: "linear",
                  x: 0,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  colorStops: [{
                      offset: 0,
                      color: 'rgba(7,68,153, 1)',
                    },
                    {
                      offset: 1,
                      color: 'rgba(7,68,153, 0)',
                    },
                  ],
                },
              },
            },
          },
          data: seriesData.dataList[0],
  
  
        },
        {
          name: '沈阳市',
          type: 'line',
          smooth: true,
          symbol: 'none', // 设置为 'none' 去掉折线图的点
          itemStyle: {
            normal: {
              color: 'rgba(43,254,192, 1)',
              lineStyle: {
                color: 'rgba(43,254,192, 1)',
                width: 1.5,
              },
              areaStyle: {
                color: {
                  type: "linear",
                  x: 0,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  colorStops: [{
                      offset: 0,
                      color: 'rgba(43,254,192, 1)',
                    },
                    {
                      offset: 1,
                      color: 'rgba(43,254,192, 0)',
                    },
                  ],
                },
              },
            },
          },
  
          data: seriesData.dataList[1],
  
  
        },
      ]
  
    }
  
    return option;
  
  }